using APP.HELPER.Data.Helper;
using System;
using System.Data.SqlClient;
namespace Common.Class
{
	public class SysOption
	{
		private string _mOptionValue;
		private static string _mLanguage = "VN";
		private static bool _mBatch;
		private static bool _mLimit;
		private static bool _mNegative;
		private static string _mCurrency = "VND";
		private static string _mReportLanguage = "VN";
		private static string _mReportLocalization = "vi-VN";
		public string OptionValue
		{
			get
			{
				return this._mOptionValue;
			}
			set
			{
				this._mOptionValue = value;
			}
		}
		public static string Language
		{
			get
			{
				return SysOption._mLanguage;
			}
			set
			{
				SysOption._mLanguage = value;
			}
		}
		public static bool Batch
		{
			get
			{
				return SysOption._mBatch;
			}
			set
			{
				SysOption._mBatch = value;
			}
		}
		public static bool Limit
		{
			get
			{
				return SysOption._mLimit;
			}
			set
			{
				SysOption._mLimit = value;
			}
		}
		public static bool Negative
		{
			get
			{
				return SysOption._mNegative;
			}
			set
			{
				SysOption._mNegative = value;
			}
		}
		public static string Currency
		{
			get
			{
				return SysOption._mCurrency;
			}
			set
			{
				SysOption._mCurrency = value;
			}
		}
		public static string ReportLanguage
		{
			get
			{
				return SysOption._mReportLanguage;
			}
			set
			{
				SysOption._mReportLanguage = value;
			}
		}
		public static string ReportLocalization
		{
			get
			{
				return SysOption._mReportLocalization;
			}
			set
			{
				SysOption._mReportLocalization = value;
			}
		}
		public SysOption()
		{
			this._mOptionValue = "";
		}
		public string Get(string optionID)
		{
			string result = "";
			string[] myParams = new string[]
			{
				"@Option_ID"
			};
			object[] myValues = new object[]
			{
				optionID
			};
			SqlHelper sqlHelper = new SqlHelper();
			SqlDataReader sqlDataReader = sqlHelper.ExecuteReader("SYS_OPTION_Get", myParams, myValues);
			if (sqlDataReader != null)
			{
				while (sqlDataReader.Read())
				{
					Convert.ToString(sqlDataReader["Option_ID"]);
					this._mOptionValue = Convert.ToString(sqlDataReader["OptionValue"]);
					Convert.ToInt32(sqlDataReader["ValueType"]);
					Convert.ToString(sqlDataReader["Description"]);
					result = "OK";
				}
				sqlDataReader.Close();
				sqlHelper.Close();
			}
			return result;
		}
		public static void LoadBatch()
		{
			SysOption sysOption = new SysOption();
			sysOption.Get("Batch");
			SysOption._mBatch = (sysOption.OptionValue == "1");
		}
		public static void LoadLimit()
		{
			SysOption sysOption = new SysOption();
			sysOption.Get("Limit");
			SysOption._mLimit = (sysOption.OptionValue == "1");
		}
		public static void LoadNegative()
		{
			SysOption sysOption = new SysOption();
			sysOption.Get("Negative");
			SysOption._mNegative = (sysOption.OptionValue == "1");
		}
	}
}
